package com.jason.campusinn.view;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.client.HttpRequest;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.yuandian.wanna.BaseActivity;
import com.yuandian.wanna.R;
import com.yuandian.wanna.WannaApp;
import com.yuandian.wanna.adapter.beautyClothing.DesginColorAdapter;
import com.yuandian.wanna.adapter.beautyClothing.DesginConstellationAdapter;
import com.yuandian.wanna.bean.beautyClothing.CategoriesBean;
import com.yuandian.wanna.constants.Constants;
import com.yuandian.wanna.constants.InterfaceConstants;
import com.yuandian.wanna.constants.SharedPreferenceConstants;
import com.yuandian.wanna.utils.CommonMethodUtils;
import com.yuandian.wanna.utils.DisplayUtil;
import com.yuandian.wanna.utils.HttpRequestCallBack;
import com.yuandian.wanna.utils.HttpUtil;
import com.yuandian.wanna.utils.LogUtil;
import com.yuandian.wanna.utils.SharedPreferenceUtil;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/** 添加刺绣
 * Created by yuandian on 2015/5/8.
 */
public class DesignEmbroideryDialog extends Dialog implements View.OnClickListener {
    private Context mCotnext;
    @ViewInject(R.id.dialog_design_embroidery_iv_close)
    private ImageView mIvClose;
    @ViewInject(R.id.dialog_design_embroidery_btn_enter)
    private Button mBtnEnter;
    @ViewInject(R.id.dialog_design_embroidery_btn_text)
    private LinearLayout mBtnFont;
    @ViewInject(R.id.dialog_design_embroidery_btn_constellation)
    private LinearLayout mBtnConstellation;
    @ViewInject(R.id.design_embroidery_edit_text)
    private EditText mEidtText;
    @ViewInject(R.id.design_embroidery_constellation_tv)
    private TextView mTvConstellation;
    @ViewInject(R.id.design_embroidery_choose_constellation_gridview)
    private GridView mGridConstellation;
    @ViewInject(R.id.design_embroidery_radiogroup_position)
    private RadioGroup mRadioGroupPosition;
    @ViewInject(R.id.dialog_design_embroidery_tv_font)
    private TextView mTvFont;
    @ViewInject(R.id.design_embroidery_radiogroup_font)
    private RadioGroup mRadopGroupFont;
    @ViewInject(R.id.design_embroidery_font_radio_book_man)
    private RadioButton mRadioBookMan;
    @ViewInject(R.id.design_embroidery_font_radio_perpetua)
    private RadioButton mRadioPerpetua;
    @ViewInject(R.id.design_embroidery_font_radio_helvetica)
    private RadioButton mRadioHelvetica;
    @ViewInject(R.id.design_embroidery_choose_color_gridview)
    private GridView mGridViewColor;
    @ViewInject(R.id.tv_position_title)
    private TextView tv_position_title;
    @ViewInject(R.id.tv_text_title)
    private TextView tv_text_title;
//    @ViewInject(R.id.design_embroidery_radio_position_1)
//    private RadioButton rb_position_1;
//    @ViewInject(R.id.design_embroidery_radio_position_2)
//    private RadioButton rb_position_2;
//    @ViewInject(R.id.design_embroidery_radio_position_3)
//    private RadioButton rb_position_3;

    private int collectType=1;
    private DesginColorAdapter mAdapter;
    private DesginConstellationAdapter mConstellationAdapter;
    private String tagFontID="";//4771 默认值
    private String tagColorID="";//6000
    private String locationID="";
    private String constellationID="";//(白羊)
    private String categoryType;
    private int mFrom;//区分美物、造物、奋斗者
    private String mSupportType = "0";
    private String mProcessCode = "";//获取定制项code

    public List<Map<String, List<String>>> mConflictList; // record conflict list

    private List<CategoriesBean> categoriesBeans = new ArrayList<>();

    private DesignFamousBrandDialog.DesignCallBack callBack;
    public DesignEmbroideryDialog(Context mCotnext,String categoryType){
        super(mCotnext, R.style.dialog_style);
        this.mCotnext = mCotnext;
        this.categoryType = categoryType;
        LogUtil.d("categoryType==========" + categoryType);
        initViews();
//        initPositionRadioButton();
        initContent();
    }

    public DesignEmbroideryDialog(Context mCotnext,String categoryType,int mFrom,String mProcessCode){
        super(mCotnext, R.style.dialog_style);
        this.mCotnext = mCotnext;
        this.categoryType = categoryType;
        LogUtil.d("categoryType=========="+categoryType);
        setmFrom(mFrom);
        setmProcessCode(mProcessCode);
        initViews();
//        initPositionRadioButton();
        initContent();
    }

    /**根据跳转类型判断刺绣位置*/
    public void setmFrom(int mFrom) {
        this.mFrom = mFrom;
        if (mFrom == Constants.BEAUTIFY_INTENT_TO_CUSTOM_MADE_DETAIL){
            mSupportType = "1";
        } else if (mFrom == Constants.CREATE_INTENT_TO_CUSTOM_MADE_DETAIL){
            mSupportType = "2";
        } else if (mFrom == Constants.DESIGNER_INTENT_TO_CUSTOM_MADE_DETAIL){
            mSupportType = "3";
        }
    }

    /**根据已选择的工艺码来去除工艺冲突的刺绣位置*/
    public void setmProcessCode(String mProcessCode) {
        this.mProcessCode = mProcessCode;
        //获取定制冲突
//        if( ! convertConflictData()){
//            getConflictDetails();
//        } else {
//            getDataFromAssets();
//        }
    }

    private void initViews() {
        setOwnerActivity((Activity) mCotnext);
        Window dialogWindow = getWindow();
        WindowManager.LayoutParams lp = dialogWindow.getAttributes();
        dialogWindow.setGravity(Gravity.BOTTOM);
        dialogWindow.setWindowAnimations(R.style.dialogMenu);
        dialogWindow.setAttributes(lp);
        LayoutInflater inflater = LayoutInflater.from(mCotnext);
        View view = inflater.inflate(R.layout.dialog_design_embroidery, null);
        setContentView(view);
        setCanceledOnTouchOutside(true);
        ViewUtils.inject(this, view);

        mIvClose.setOnClickListener(this);
        mBtnEnter.setOnClickListener(this);
        mBtnFont.setOnClickListener(this);
        mBtnConstellation.setOnClickListener(this);

        mAdapter = new DesginColorAdapter(mCotnext) {
            @Override
            public void setColor(String colorID) {
                tagColorID= colorID;
                LogUtil.d("tagColorID======"+tagColorID);
            }
        };
        mGridViewColor.setAdapter(mAdapter);
        mConstellationAdapter = new DesginConstellationAdapter(mCotnext) {
            @Override
            public void setConstellation(String constellation) {
                constellationID = "(" + constellation + ")";
            }
        };
        mGridConstellation.setAdapter(mConstellationAdapter);

        //获取定制冲突
        if( ! convertConflictData()){
            getConflictDetails();
        } else {
         getDataFromAssets();
        }

        mRadioGroupPosition.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId){
                    default:
                        locationID = categoriesBeans.get(checkedId-10000).getLocationCode();
                        LogUtil.d("LocationID========"+locationID);
                        break;
//                    case R.id.design_embroidery_radio_position_1:
//                        locationID = "1005";
//                        break;
//                    case R.id.design_embroidery_radio_position_2:
//                        locationID = "1006";
//                        break;
//                    case R.id.design_embroidery_radio_position_3:
//                        locationID = "2087";
//                        break;
                }
            }
        });
        mRadopGroupFont.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId) {
                    case R.id.design_embroidery_font_radio_book_man:
//                        tagFontID = "RC12";
                        tagFontID = "4773";
                        break;
                    case R.id.design_embroidery_font_radio_perpetua:
//                        tagFontID = "RC11";
                        tagFontID = "4772";
                        break;
                    case R.id.design_embroidery_font_radio_helvetica:
//                        tagFontID = "RC10";
                        tagFontID = "4771";
                        break;
                }
            }
        });

//        mRadioGroupPosition.check(R.id.design_embroidery_radio_position_1);
//        mRadopGroupFont.check(R.id.design_embroidery_font_radio_helvetica);
//        mRadioBookMan.setTypeface(WannaApp.mFontTypefaceLight);
//        mRadioPerpetua.setTypeface(WannaApp.mFontTypefaceMedium);
//        mRadioHelvetica.setTypeface(WannaApp.mFontTypefaceNormal);

        setSelected(1);
    }

    //    获取定制冲突信息
    private void getConflictDetails(){

        mConflictList = new ArrayList<>();

        HttpUtil.sendJsonRequest(HttpRequest.HttpMethod.GET, InterfaceConstants.GET_TECHNICAL_CONFICT_DETAILS,
                "", new HttpRequestCallBack<String>() {
                    @Override
                    public void onSuccessed(ResponseInfo<String> responseInfo) {
                        LogUtil.d("conficat--=" + responseInfo.result);
                        try {
                            int returnCode = 0;
                            JSONObject base = new JSONObject(responseInfo.result);
                            if (base.has("returnCode")) {
                                returnCode = base.getInt("returnCode");
                            }
                            if (returnCode == 200 && base.has("returnData")) {
                                JSONObject returnData = base.getJSONObject("returnData");
                                mConflictList = new ArrayList<Map<String, List<String>>>();
                                Map<String, List<String>> map;
                                Iterator<String> it = returnData.keys();
                                String key;
                                List<String> mListDetail;
                                while (it.hasNext()) {
                                    map = new HashMap<String, List<String>>();
                                    mListDetail = new ArrayList<String>();
                                    key = it.next();
                                    JSONArray array = returnData.getJSONArray(key);
                                    for (int i = 0; i < array.length(); i++) {
                                        mListDetail.add(array.get(i).toString());
                                    }
                                    map.put(key, mListDetail);
                                    mConflictList.add(map);
                                }
                            }
                            SharedPreferenceUtil.setSharedStringData(mCotnext,SharedPreferenceConstants.CONFLICT_DETAIL,responseInfo.result);
                            getDataFromAssets();
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }

                    }

                    @Override
                    public void onFailed(HttpException exception, String reason) {

                    }

                }, 0);
    }

    private boolean convertConflictData(){

        String str = SharedPreferenceUtil.getSharedStringData(mCotnext,
                SharedPreferenceConstants.CONFLICT_DETAIL);

        if( ! CommonMethodUtils.isEmpty( str )) {

            LogUtil.d("conficat--=" + str);

            mConflictList = new ArrayList<>();

            try {
                int returnCode = 0;
                JSONObject base = new JSONObject(str);
                if (base.has("returnCode")) {
                    returnCode = base.getInt("returnCode");
                }
                if (returnCode == 200 && base.has("returnData")) {
                    JSONObject returnData = base.getJSONObject("returnData");
                    mConflictList = new ArrayList<Map<String, List<String>>>();
                    Map<String, List<String>> map;
                    Iterator<String> it = returnData.keys();
                    String key;
                    List<String> mListDetail;
                    while (it.hasNext()) {
                        map = new HashMap<String, List<String>>();
                        mListDetail = new ArrayList<String>();
                        key = it.next();
                        JSONArray array = returnData.getJSONArray(key);
                        for (int i = 0; i < array.length(); i++) {
                            mListDetail.add(array.get(i).toString());
                        }
                        map.put(key, mListDetail);
                        mConflictList.add(map);
                    }
                }

                return true;

            } catch (JSONException e) {
                e.printStackTrace();
            }

        }else{
            return false;
        }

        return false;
    }

    private void getDataFromAssets(){

        String jsonStr="";
        jsonStr=CommonMethodUtils.getAssetsData(mCotnext, "categories.json");
        try {
            JSONObject obj = new JSONObject(jsonStr);
            JSONArray jsonArray = obj.getJSONArray("categories");
            for (int i=0;i<jsonArray.length();i++){
                JSONObject jsonObject = (JSONObject)jsonArray.opt(i);

                CategoriesBean bean = new CategoriesBean();
                bean.setLocationCode(jsonObject.getString("locationCode"));
                bean.setCategoryName(jsonObject.getString("categoryName"));
                bean.setLocationName(jsonObject.getString("locationName"));
                bean.setSupport_type(jsonObject.getString("support_type"));
                categoriesBeans.add(bean);
            }
            //动态添加RadioButton
            addRadioButton(categoriesBeans);

        } catch (JSONException e) {
            e.printStackTrace();
        }

    }

    /**
     * 动态添加位置RadioButton
     * @param list
     */
    private void addRadioButton(List<CategoriesBean> list){
        List<String> mListConflict = new ArrayList<>();
        String conflictCode = "";
          if (!mProcessCode.isEmpty()){
              String [] processes = mProcessCode.split(",");
//              for (int i = 0; i < processes.length;i++){
                  for (int j = 0;j < mConflictList.size();j++){
                      Map<String,List<String>> map = mConflictList.get(j);
                      for (String key:map.keySet()){
                          if (mProcessCode.contains(key)){
                              mListConflict.addAll(map.get(key));
                          }
                      }
                  }
//              }
          }
        if (!mListConflict.isEmpty()){
            for (int i = 0;i < mListConflict.size();i++){
                conflictCode = conflictCode +  mListConflict.get(i) + ",";
            }
        }
//        RadioButton tempButton = new RadioButton(mCotnext);
//        tempButton.setBackgroundResource(R.drawable.white_corner_button_selector);
//        tempButton.setTextColor(mCotnext.getResources().getColor(R.color.custom_made_detail_radio_text_selector));
        if (categoryType!=null){
            for (int i=0;i<list.size();i++){
                if (categoryType.equals(list.get(i).getCategoryName())){
                    if (list.get(i).getSupport_type().contains(mSupportType)) {

                        RadioButton tempButton = (RadioButton) LayoutInflater.from(mCotnext).inflate(
                                R.layout.radio_button, null);
                        tempButton.setText(list.get(i).getLocationName());
                        tempButton.setId(10000 + i);
                        RadioGroup.LayoutParams params = new RadioGroup.
                                LayoutParams(/*LinearLayout.LayoutParams.MATCH_PARENT*/0,
                                LinearLayout.LayoutParams.MATCH_PARENT, 1.0f);
                        if (mRadioGroupPosition.getChildCount() < 2) {
//                    params.setMargins(DisplayUtil.dip2px(20,WannaApp.getInstance().mScreenDensity), 0, 0, 0);
                            params.setMargins(0, 0, DisplayUtil.dip2px(20, WannaApp.getInstance().mScreenDensity), 0);
                        }
                        tempButton.setLayoutParams(params);
                        if (list.get(i).getSupport_type().contains(mSupportType)) {
//                        tempButton.setTextColor(mCotnext.getResources().getColor(R.color.light_text_gray));
//                        tempButton.setBackgroundResource(R.drawable.gray_enalbe_circle_corner);
//                        tempButton.setEnabled(false);
                        } else {
                        }
                        mRadioGroupPosition.addView(tempButton);
                        if (mRadioGroupPosition.getChildCount() == 1) {
//                            tempButton.setChecked(true);
//                            locationID = categoriesBeans.get(i).getLocationCode();
                            LogUtil.d("LocationID========" + locationID);
                        }
//                    if (!list.get(i).getSupport_type().contains(mSupportType)){
//                        tempButton.setTextColor(mCotnext.getResources().getColor(R.color.light_text_gray));
//                        tempButton.setBackgroundResource(R.drawable.gray_enalbe_circle_corner);
//                        tempButton.setEnabled(false);
//                    }
                        if (conflictCode.contains(list.get(i).getLocationCode())) {
                            tempButton.setTextColor(mCotnext.getResources().getColor(R.color.light_text_gray));
                            tempButton.setBackgroundResource(R.drawable.gray_enalbe_circle_corner);
                            tempButton.setEnabled(false);

                        }

                    }
                }
            }
        }else {//展示三个固定button，后续需要删除
            for (int i=0;i<2;i++){
                RadioButton tempButton = (RadioButton) LayoutInflater.from(mCotnext).inflate(
                        R.layout.radio_button, null);
                if (i==0){
                    tempButton.setText("名牌上");
                }else {
                    tempButton.setText("左口袋上");
                }

                tempButton.setId(10000 + i);
                RadioGroup.LayoutParams params = new RadioGroup.
                        LayoutParams(/*LinearLayout.LayoutParams.MATCH_PARENT*/0,
                        LinearLayout.LayoutParams.MATCH_PARENT, 1.0f);
                if (mRadioGroupPosition.getChildCount()<2){
//                    params.setMargins(DisplayUtil.dip2px(20,WannaApp.getInstance().mScreenDensity), 0, 0, 0);
                    params.setMargins(0,0,DisplayUtil.dip2px(20,WannaApp.getInstance().mScreenDensity),0);
                }
                tempButton.setLayoutParams(params);
                mRadioGroupPosition.addView(tempButton);
                if (mRadioGroupPosition.getChildCount()==1){
//                    tempButton.setChecked(true);
//                    locationID = categoriesBeans.get(i).getLocationCode();
                    LogUtil.d("LocationID========" + locationID);
                }
            }
        }
        if (mRadioGroupPosition.getChildCount()==0){
            tv_position_title.setVisibility(View.GONE);
            mRadioGroupPosition.setVisibility(View.GONE);

        }
//        mRadioGroupPosition.check(mRadioGroupPosition.getChildAt(0).getId());

    }


    private void initContent(){

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.dialog_design_embroidery_iv_close://归零
                tagFontID="";
                tagColorID="";
//                locationID="";
                constellationID="";
                mEidtText.setText("");
                mAdapter.setmLastSelectedPosition(-2);
                mConstellationAdapter.setmLastSelectedPosition(-1);
//                if (mRadioGroupPosition.getVisibility() == View.VISIBLE) {
//                    RadioButton radioButton = (RadioButton) mRadioGroupPosition.getChildAt(0);
//                    radioButton.setChecked(true);
//                    mRadioGroupPosition.clearCheck();
//                }
                if (collectType == 1){
                    mRadopGroupFont.check(R.id.desing_famous_brand_radio_font_helvetica);
                    callBack.setDesignChanged("添加英文刺绣",tagColorID,tagFontID,mEidtText.getText().toString(),locationID,constellationID,1);
                } else {
                    callBack.setDesignChanged("添加星座刺绣",tagColorID,tagFontID,"",locationID,constellationID,1);
                }
                this.dismiss();
                break;
            case R.id.dialog_design_embroidery_btn_enter:

                if (collectType==1){
                    if (TextUtils.isEmpty(mEidtText.getText().toString().trim())) {
                        Toast.makeText(mCotnext, "请输入刺绣内容！", Toast.LENGTH_LONG).show();
                    } else if (CommonMethodUtils.isEmpty(locationID)) {
                        Toast.makeText(mCotnext, "请选择刺绣位置！", Toast.LENGTH_LONG).show();
                        return;
                    } else if (CommonMethodUtils.isEmpty(tagFontID)) {
                        Toast.makeText(mCotnext, "请选择字体！", Toast.LENGTH_LONG).show();
                        return;
                    } else if (CommonMethodUtils.isEmpty(tagColorID)) {
                        Toast.makeText(mCotnext, "请选择颜色！", Toast.LENGTH_LONG).show();
                        return;
                    } else {
                        callBack.setDesignChanged("已添加英文刺绣", tagColorID, tagFontID, mEidtText.getText().toString(), locationID, constellationID, 1);
                        this.dismiss();
                    }
                }else {
                    if (CommonMethodUtils.isEmpty(constellationID)){
                        Toast.makeText(mCotnext, "请选择星座！", Toast.LENGTH_LONG).show();
                        return;
                    }else if (CommonMethodUtils.isEmpty(locationID)) {
                        Toast.makeText(mCotnext, "请选择刺绣位置！", Toast.LENGTH_LONG).show();
                        return;
                    } else if (CommonMethodUtils.isEmpty(tagColorID)) {
                        Toast.makeText(mCotnext, "请选择颜色！", Toast.LENGTH_LONG).show();
                        return;
                    }
                    callBack.setDesignChanged("已添加星座刺绣",tagColorID,tagFontID,"",locationID,constellationID,1);
                    this.dismiss();
                }
                break;
            case R.id.dialog_design_embroidery_btn_text:
                if (!CommonMethodUtils.isEmpty(constellationID)){
//                    setSelected(1);
                   Dialog dialog = new AlertDialog.Builder(mCotnext).setTitle("提示")
                           .setMessage("确定要放弃星座刺绣的数据吗？").setPositiveButton("确定",new OnClickListener() {
                               @Override
                               public void onClick(DialogInterface dialog, int which) {
                                   setSelected(1);
                                   dialog.dismiss();
                               }
                           }).setNegativeButton("取消",new OnClickListener() {
                               @Override
                               public void onClick(DialogInterface dialog, int which) {
                                   dialog.dismiss();
                               }
                           }).create();
                    dialog.show();
                } else {
                    setSelected(1);
                }
                break;
            case R.id.dialog_design_embroidery_btn_constellation:
                if (!mBtnConstellation.isSelected()){

                    if (!TextUtils.isEmpty(mEidtText.getText().toString().trim())){
                        Dialog dialog = new AlertDialog.Builder(mCotnext).setTitle("提示")
                                .setMessage("确定要放弃英文刺绣的数据吗？").setPositiveButton("确定",new OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        setSelected(2);
                                        dialog.dismiss();
                                    }
                                }).setNegativeButton("取消",new OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        dialog.dismiss();
                                    }
                                }).create();
                        dialog.show();
                    }else {
                        setSelected(2);
                    }

                }
                break;
        }

    }

    private void setSelected(int type) {
        constellationID = "";
        tagColorID = "";
        tagFontID = "";
        if (type == 1) {
            collectType = 1;
            mBtnFont.setSelected(true);
            mBtnConstellation.setSelected(false);
            mTvConstellation.setVisibility(View.GONE);
            mGridConstellation.setVisibility(View.GONE);
            mEidtText.setVisibility(View.VISIBLE);
            mTvFont.setVisibility(View.VISIBLE);
            tv_text_title.setVisibility(View.VISIBLE);
            mRadopGroupFont.setVisibility(View.VISIBLE);

        } else {//星座
            collectType = 2;
//            constellationID="(白羊)";
            mBtnConstellation.setSelected(true);
            mBtnFont.setSelected(false);
            mTvConstellation.setVisibility(View.VISIBLE);
            mGridConstellation.setVisibility(View.VISIBLE);
            mEidtText.setVisibility(View.GONE);
            tv_text_title.setVisibility(View.GONE);
            mTvFont.setVisibility(View.GONE);
            mRadopGroupFont.setVisibility(View.GONE);
            mEidtText.setText("");
        }
//        mRadopGroupFont.check(R.id.design_embroidery_font_radio_helvetica);
        mAdapter.setmLastSelectedPosition(-2);
        mConstellationAdapter.setmLastSelectedPosition(-1);
        if (mRadioGroupPosition.getVisibility() == View.VISIBLE) {
//            RadioButton radioButton = (RadioButton) mRadioGroupPosition.getChildAt(0);
//            if (radioButton != null){
//                radioButton.setChecked(true);
//                mRadioGroupPosition.clearCheck();
//            }
////            mRadioGroupPosition.check(mRadioGroupPosition.getCheckedRadioButtonId());
        }
//        mRadioGroupPosition.clearCheck();
//        mRadioGroupPosition.check(10002);

    }

    public void setCallBack(DesignFamousBrandDialog.DesignCallBack callBack){
        this.callBack = callBack;
    }


}
